﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frmListBook.aspx.cs" Inherits="BSPortal.Usercontrol.Admin.Book.ListBook.frmListBook" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="/CSS/Style.css" rel="stylesheet" type="text/css" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

    <script language="javascript" type="text/javascript">
        function setUrlLength(editor) {
            editor.get_dialogOpener()._dialogUrlLengthLimit = 200;
        }
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog      
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow; //IE (and Moz as well)      
            return oWindow;
        }

        function Close() {
            var arg = new Object();
            arg.Modified = document.getElementById('<%=hdModified.ClientID %>').value;
            GetRadWindow().Close(arg);
        }
        function getRandomNumber() {
            var randomnumber = Math.random(10000);
            return randomnumber;
        }
        function isNumberKey(evt) {
            var charCode = (evt.which) ? evt.which : event.keyCode
            if ((charCode >= 48 && charCode <= 57) || charCode ==46)
                return true;
            return false;
        }

        function OnClientAsyncFileUploadComplete(sender, args) {
            var handlerPage = '<%= Page.ResolveClientUrl("~/ImageHandler.ashx")%>';
            var queryString = '?imagefor=book&randomno=' + getRandomNumber();
            var src = handlerPage + queryString;
            var clientId = '<%=previewImage.ClientID %>';
            document.getElementById(clientId).setAttribute("src", src);
        }
    </script>

    <asp:ToolkitScriptManager ID="toolKitScriptManager" runat="server">
    </asp:ToolkitScriptManager>
    <asp:UpdatePanel runat="server" ID="updatePanel1" RenderMode="Inline" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="Panel1" DefaultButton="btnSave" runat="server">
                <br />
                <table style="width: 100%;">
                    <tr>
                        <td>
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;ID:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtId" runat="server" Width="200px" Enabled="False"></asp:TextBox>
                        </td>
                        <td align="left" id="tdImage" runat="server" rowspan="8">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hình ảnh: &nbsp; &nbsp;
                        </td>
                        <td align="left" id="tdImage2" runat="server" rowspan="8">
                            <asp:Image ID="previewImage" runat="server" Height="260px" Width="185px" />
                            <br />
                            <asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadComplete="OnClientAsyncFileUploadComplete"
                                OnUploadedComplete="AsyncFileUpload1_UploadedComplete" ThrobberID="spanUploading"
                                UploaderStyle="Modern" UploadingBackColor="#CCFFFF" Width="200px" />
                            <br />
                            <span id="spanUploading" runat="server">Uploading...</span><br />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Tên sản phẩm
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rqfPassword" ControlToValidate="txtName" runat="server"
                                ErrorMessage="(*)" ValidationGroup="ProductPriceNews"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr id="trWriter" runat="server">
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Tác giả:&nbsp;
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlAuthor" runat="server" Enabled="true" Width="200px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= publisherName %>:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlPublishName" runat="server" Width="200px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Giá:&nbsp;
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtPrice" runat="server" onkeypress="return isNumberKey(event)"
                                Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Giảm giá:&nbsp;
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtDiscount" onkeypress="return isNumberKey(event)" runat="server"
                                Width="200px"></asp:TextBox>&nbsp;%
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Phí chuyển:&nbsp;
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtfee" runat="server" onkeypress="return isNumberKey(event)" Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Thể Loại:
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlCategory" runat="server" Enabled="true" Width="200px">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Nhà cung cấp:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtDistributor" runat="server"  Width="200px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp; Hiển thị:
                        </td>
                        <td align="left">
                            <asp:CheckBox ID="chkIsPublished" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Nội dung:&nbsp;
                        </td>
                        <td align="left" colspan="3">
                            &nbsp;
                            <%--<cc1:Editor ID="Editor1" Height="500px" runat="server" Font-Names="Arial" NoUnicode="True"/>--%>
                            <telerik:RadEditor ID="reContent" runat="server" Height="400px" OnClientLoad="setUrlLength"
                                ToolbarMode="Default" Width="600px">
                                <ImageManager DeletePaths="~/Images" MaxUploadFileSize="204800000" UploadPaths="~/Images"
                                    ViewPaths="~/Images" />
                                <Content>
                                </Content>
                            </telerik:RadEditor>
                        </td>
                    </tr>
                    <tr id="trTechnicInfo" runat="server">
                        <td>
                            &nbsp;
                        </td>
                        <td align="left">
                            &nbsp;&nbsp;&nbsp;&nbsp;Thông tin kỹ thuật:&nbsp;
                        </td>
                        <td align="left" colspan="3">
                            &nbsp;
                            <telerik:RadEditor Width="600px" Height="400px" ID="reTechnicInfo" runat="server"
                                ToolbarMode="Default" OnClientLoad="setUrlLength">
                                <ImageManager DeletePaths="~/Images" ViewPaths="~/Images" UploadPaths="~/Images"
                                    MaxUploadFileSize="204800000" />
                                <Content>
                                </Content>
                            </telerik:RadEditor>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 20px;" align="center" colspan="5">
                            <strong>
                                <asp:Label ID="lblStatus" runat="server" CssClass="sm_error"></asp:Label>
                            </strong>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="5">
                            <asp:Button ID="btnSave" runat="server" CssClass="Submit" Text="Lưu" ValidationGroup="ProductPriceNews"
                                OnClick="btnSave_Click" />&nbsp;
                            <asp:Button ID="btnReset" CssClass="Submit" runat="server" Text="Nhập lại" OnClick="btnReset_Click" />&nbsp;
                            <asp:Button ID="btnCancel" CssClass="Submit" runat="server" Text="Đóng" OnClientClick="Close()" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="5">
                            <br />
                            <asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="10" DynamicLayout="false">
                                <ProgressTemplate>
                                    <span>
                                        <asp:Image alt="" ID="imgLoading" ImageUrl="~/images/loader2.gif" runat="server" /></span>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </td>
                    </tr>
                </table>
                <asp:HiddenField ID="hdModified" runat="server" />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
